home *** CD-ROM | disk | FTP | other *** search
/ MacHome 2001 June / MacHome Magazine Demo Disc June 2001.iso / Stuff / Software / Graphic / PageSpinner 3.0.2 / Examples / JavaScript / Scrolling Text Stationery < prev    next >
Encoding:
Text File  |  2000-10-16  |  2.3 KB  |  88 lines  |  [TEXT/JyWs]

  1. <html>
  2. <head>
  3. <title>JavaScript Scrolling Text</title>
  4.  
  5. <script language="JavaScript" type="text/javascript">
  6. <!--
  7. /* 
  8.     Copyright (C)1996 Web Integration Systems, Inc. DBA Websys, Inc.
  9.        All Rights Reserved.
  10.  
  11.     This applet can be re-used or modified, if credit is given in 
  12.     the source code. We will not be held responsible for any unwanted 
  13.     effects due to the usage of this applet or any derivative.  
  14.     No warrantees for usability for any specific application are given
  15.      or implied.
  16.  
  17.     Chris Skinner, January 30th, 1996.
  18.     Hacked for CNNfn by RD, Jan. 31, 1996
  19. */
  20.  
  21. function scrollit(seed)
  22. {
  23.     var m1  = "This is an example of scrolling text using JavaScript";
  24.     var m2  = " . . . you can put your own message here to get attention";
  25.     var m3  = " . . . Please enjoy PageSpinner! ";
  26.     
  27.     var msg=m1+m2+m3;
  28.     var out = " ";
  29.     var c   = 1;
  30.  
  31.     if (seed > 100) {
  32.         seed--;
  33.         var cmd="scrollit(" + seed + ")";
  34.         timerTwo=window.setTimeout(cmd,100);
  35.     }
  36.     else if (seed <= 100 && seed > 0) {
  37.         for (c=0 ; c < seed ; c++) {
  38.             out+=" ";
  39.         }
  40.         out+=msg;
  41.         seed--;
  42.         var cmd="scrollit(" + seed + ")";
  43.             window.status=out;
  44.         timerTwo=window.setTimeout(cmd,100);
  45.     }
  46.     else if (seed <= 0) {
  47.         if (-seed < msg.length) {
  48.             out+=msg.substring(-seed,msg.length);
  49.             seed--;
  50.             var cmd="scrollit(" + seed + ")";
  51.             window.status=out;
  52.             timerTwo=window.setTimeout(cmd,100);
  53.         }
  54.         else {
  55.             window.status=" ";
  56.             timerTwo=window.setTimeout("scrollit(100)",75);
  57.         }
  58.     }
  59. }
  60. // -->
  61. </script>
  62.  
  63. </head>
  64.  
  65. <body onLoad="timerONE=window.setTimeout('scrollit(100)',500);">
  66.  
  67. <h1>JavaScript Scrolling Text</h1>
  68.  
  69. <b>This stationary page contains a Java that displays a scrolling message in the status area in Netscape Navigator/Internet Explorer. </b>
  70.  
  71. <p>
  72. The script is named <b>scrollit</b> and it is placed in the HEAD section of the HTML document.  It is executed inside the BODY start tag:</p>
  73.  
  74. <pre><BODY onLoad="timerONE=window.setTimeout('scrollit(100)',500);"></pre>
  75.  
  76. <p>
  77. Replace the text inside the script with your own message and edit the page or copy the entire script to an existing page:</p>
  78.  
  79. <pre>function scrollit(seed)
  80. {
  81. var m1  = "This is an axemple of scrolling text using JavaScript";
  82. var m2  = " . . . you can put your own message here to get attention";
  83. var m3  = " . . . Please enjoy PageSpinner! ";</pre>
  84.  
  85.  
  86. </body>
  87. </html>
  88.